<?php

include_once '../init.php';
class ServiceTests {
	
	
	
	public static function add(){
		$s = new Service();
		$s->setDesc("lblblal lbalgb");
		$s->setName("Test name");
		$s->setPeriod(10);
		$s->setPrice(200);
		
		ServiceUtils::add($s);
	}
	
	public static function get(){
		
		ServiceUtils::get("2");
	}
	
	public static function rem(){
		ServiceUtils::removeById(1);
		
	}
	
	public static function modify(){
		$s = new Service();
		$s->setName("test");
		$s->setId(4);
		$s->setPrice(100);
		$s->setPeriod(2);
		$s->setActive(false);
		if(ServiceUtils::modify($s)){
			echo "si";
		}else{
			echo "not si";
		}
	}
	
	public static function assignPromotion(){
		$s = new Service();
		$s->setId(1);
		
		$p = new Promotion();
		$p->setId(3);
		
		ServiceUtils::assignPromotion($s , $p);
	
	}
	
	public static function unAssignPromotion(){
		// TODO
	}
	
	
	
	public static function find(){
		$controls = new ServiceSearchControls();
		$controls->setActive(true);
//		$controls->setPromotion(false);
//		$controls->addType(ServiceType::TV_SERVICE);
//		$controls->setPartName("HBO");
		ServiceUtils::find($controls);
	}
	
	
	
	public static function addPart(){
		$sp = new ServicePart();
		$sp->setName("CANAL +");
		$sp->setType(ServiceType::TV_SERVICE);
				
		ServiceUtils::addPart($sp);
		$sp->setName("MOtoroalla");
		$sp->setType(ServiceType::PHONE_SERVICE);

		ServiceUtils::addPart($sp);
		$sp->setName("NOKIE");
		$sp->setType(ServiceType::PHONE_SERVICE);
		
		ServiceUtils::addPart($sp);
	}
	
	public static function remPart(){
		
		// INTEGRALNOSCIOWKA PRZEMYSLEC
		ServiceUtils::removePartById(1);
	}
	
	
	public static function modifyPart(){
		$sp = new ServicePart();
		$sp->setName("HOB2");
		$sp->setId(1);
		$sp->setType(ServiceType::TV_SERVICE);
		
		ServiceUtils::modifyPart($sp);
	}
	
	public static function addServicePart(){
		$s = new Service();
		$s->setId(2);
		
		
		$sp = new ServicePart();
		$sp->setId(1);
		
		ServiceUtils::addServicePart($sp, $s);
	}
	
	public static function remServicePart(){
		ServiceUtils::removeServicePartByIds(2,1);
	}
	
	public static function getParts(){
		ServiceUtils::getServicePart(2);
		ServiceUtils::getAllServiceParts();
		self::add();
	}
}



//ServiceTests::add();
//ServiceTests::get();
//ServiceTests::rem();
//ServiceTests::modify();
//ServiceTests::buyService();
//ServiceTests::payForService();
ServiceTests::find();
//ServiceTests::addPart();
//ServiceTests::modifyPart();
//ServiceTests::remPart();
//ServiceTests::addServicePart();
//ServiceTests::remServicePart();
//ServiceTests::assignPromotion();


//ServiceTests::getParts();
?>
